Cannot change font properly via setFontSettings

I am trying to use setFontSettings DXL function however the outcome is not what I expect. I have a level 5 object (Object Text and Heading) that I want to change font for. My original setting is set to TAHOMA... I want to change all level 5 objects to "Courier New" in order to avoid variable length characters and obtain fixed length characters.

I am using the function setFontSettings

--> setFontSettings(5, TextFont, 2, "Courier New", true, false, userLocale)

and the reference document has the following information:

Declaration
void setFontSettings(int level,
int usedIn,
int size,
int family,
bool bold,
bool italic)
DXL Reference Manual
Operation
Sets the point size, font family, whether the font is bold, and whether the font is italic for the font usedIn for objects at
heading level level. The value of usedIn can be HeadingFont, TextFont, or GraphicsFont.
Here is the problem. When changing the font for level 5 objects all other columns defined in my module will also be converted to courier new font for all object levels. The only column behaving normally is the "Object Text and Heading" attribute.

Does anyone have experience converting fonts with DXL.

Patrick
PatrickGuay - Tue Oct 04 09:19:37 EDT 2011

Re: Cannot change font properly via setFontSettings
PatrickGuay - Tue Oct 04 12:56:31 EDT 2011

Thanks to Mathias I saw an answer that helped me out from another thread. I basically altered a supplied method to the following:

void setObjectTextToFixedWidthFontString(Object o, string fixedWidthText) {
string fixedWidthRtfPrefix = //-
"{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\ftech Courier New;}}"
string fixedWidthRtfContent = "";
string fixedWidthRtfSuffix = //-
"}\n" //-
"}";

o."Object Text" = richText( fixedWidthRtfPrefix //-
fixedWidthText //
fixedWidthRtfSuffix );
}

Re: Cannot change font properly via setFontSettings
SystemAdmin - Tue Oct 04 15:59:25 EDT 2011

PatrickGuay - Tue Oct 04 12:56:31 EDT 2011
Thanks to Mathias I saw an answer that helped me out from another thread. I basically altered a supplied method to the following:

void setObjectTextToFixedWidthFontString(Object o, string fixedWidthText) {
string fixedWidthRtfPrefix = //-
"{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\ftech Courier New;}}"
string fixedWidthRtfContent = "";
string fixedWidthRtfSuffix = //-
"}\n" //-
"}";

o."Object Text" = richText( fixedWidthRtfPrefix //-
fixedWidthText //
fixedWidthRtfSuffix );
}

I've been down that road and gave up. Although I could get text looking as I wanted in certain object cells by sandwiching it in the right RTF codes, I found other parts of DOORS would not honor the RTF markup.

Examples:
Get Object Text looking as you like.
1) Look at it in the Module Explorer. Does it render correctly there?
2) Try exporting it to Word. Did DOORS honor your RTF markup?

I could really use this local font/size functionality too. I'm just advising that you take whatever you do for a ride around the block before you invest a lot of time prettying up your stuff.

See attachment to see what I mean.
Attachments

attachment_14689618_DOORS_RTF.png